//package app;
//
//import app.context.DataListener;
//import app.processor.MessageHandler;
//import org.demon.agent.FileWatcher;
//import org.demon.asm.Opcodes;
//import org.demon.common.conf.NetWorkConfig;
//import org.demon.ioc.ApplicationContext;
//import org.demon.ioc.Banner;
//import org.demon.ioc.NetworkProtocol;
//import org.demon.ioc.Start;
//import org.demon.socket.protocol.ByteArrayProtocol;
//
//import java.util.concurrent.ExecutorService;
//import java.util.concurrent.Executors;
//
//@Start(protocol = NetworkProtocol.TCP)
//public class AppMain implements Opcodes {
//
//    private static ExecutorService[] readExecutorService = new ExecutorService[6] ;
//
//    private static ExecutorService readExecutorService1 =  Executors.newSingleThreadExecutor();
//
//    static {
//        for (int i = 0; i < 6; i++) {
//            readExecutorService[i] = Executors.newSingleThreadExecutor();
//        }
//    }
//
//
//    public static void main(String[] args) throws Exception {
////		// 获取当前年份、月份、日期
////		Calendar cale = Calendar.getInstance();
////		// 获取当月第一天和最后一天
////		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
////		String firstday, lastday;
////		// 获取前月的第一天
////		cale = Calendar.getInstance();
////		cale.add(Calendar.MONTH, 0);
////		cale.set(Calendar.DAY_OF_MONTH, 1);
////		firstday = format.format(cale.getTime());
////		// 获取前月的最后一天
////		cale = Calendar.getInstance();
////		cale.add(Calendar.MONTH, 2);
////		cale.set(Calendar.DAY_OF_MONTH, 0);
////		lastday = format.format(cale.getTime());
////		System.out.println("本月第一天和最后一天分别是 ： " + firstday + " and " + lastday);
//
//
////		ApplicationContext.setBannerMode(Banner.Mode.OFF);
////		ApplicationContext.run(AppMain.class);
////		Client client = new TcpClient("192.168.18.105", 9031);
////
////		Server server = new UdpServer(22222);
////		server.start();
////		FileWatcher fileWatcher = new FileWatcher(Paths.get("D:\\workspace-demon"),new AgentFileListener());
////		fileWatcher.watch();
////		for (int i = 0; i < 2; i++) {
////			int hashcode = client.getChannel().hashCode();
////			System.err.println(hashcode);
////			Message message = new Message<>((short) 900, new byte[0]) ;
////			client.write(message);
////		}
////		RoleVo roleVo = new RoleVo(11);
////
////		RedisUtils.hset("111".getBytes(),"111".getBytes(),roleVo.serialize());
////		for (int i = 0; i < 200; i++) {
////			int serverId = i % 6;
////			new Thread(() -> {
////				System.err.println(".....");
//////				HttpClient client = new HttpClient("localhost",6443,serverId);
////			}).start();
////		}
////		client.write();
////		loadLog(loadTxt());
////		MessageProcessor<byte[]> processor = new MessageProcessor<byte[]>() {
////			@Override
////			public void process(AioSession session, byte[] msg) {
//////                System.out.println("receive from client: " + msg.length);
//////                WriteBuffer outputStream = session.writeBuffer();
//////                try {
//////                    byte[] bytes = msg.getBytes();
//////                    outputStream.writeInt(bytes.length);
//////                    outputStream.write(bytes);
//////                } catch (IOException e) {
//////                    e.printStackTrace();
//////                }
//////				work[0].add("aaaaaa");
////				int index = Math.abs(session.hashCode()) % 6;
////				ByteBuffer byteBuffer = ByteBuffer.wrap(msg);
////				short cmd = byteBuffer.getShort();
////				byteBuffer.position(2);
////				byte[] bytes = new byte[byteBuffer.capacity() - byteBuffer.position()];
////				byteBuffer.get(bytes);
////				Message message = new Message(cmd, bytes);
////				Context context = new Context(session,message);
//////				readExecutorService[index].execute(new ReadTask(context));
//////				readExecutorService1.execute(new ReadTask(context));
////				Dispacher.dispacher.getMethodFunction(context);
////			}
////		};
////		ApplicationContext.run(AppMain.class);
////		Server server = new AioServer(25025,new ByteArrayProtocol(),processor);
////		server.start();
//
//        FileWatcher watcher = new FileWatcher("",new DataListener());
//        NetWorkConfig.setPort(25025);
//        ApplicationContext.setBannerMode(Banner.Mode.OFF);
//        ApplicationContext.run(AppMain.class,new ByteArrayProtocol(),new MessageHandler());
//        watcher.watch();
//
//    }
//
//}